package edu.hawaii.duedates;

import java.util.List;
import com.meterware.httpunit.WebConversation;

/**
 * This superclass is extended by all libraries added to DueDates. Each lender has its own way of
 * logging in and getting information. So each lender by contract need to have login and getInfo
 * method.
 * 
 * @author John Ly
 * @author John Zhou
 */
public interface Lender {

  /**
   * Attempt to login to specific lender.
   * 
   * @param id The user ID needed by the site
   * @param password The password that corresponds to that account
   * @return The WebConversation instance after successful login.
   * @throws Exception If login was not successful with these credentials.
   */
  public WebConversation login(String id, String password) throws Exception;
  
  /**
   * Given a logged in user, provides info about their checked out items.
   * 
   * @param id The user ID for the site.
   * @param password The password that corresponds to that account.
   * @param list The list to add the BorrowedItems to.
   * @return The list passed as an argument with the newly added books.
   * @throws Exception If problems occur parsing the site pages.
   */
  public List<BorrowedItem> 
    getInfo(String id, String password, List<BorrowedItem> list) throws Exception;
}

